// $Id: main.h 56 2007-05-31 20:18:18Z DarkAn9el $
/***************************************************************************
 *   Copyright (C) 2007 by Andrea Blankenstijn, Ulrich Giraud              *
 *   <darkan9el@gmail.com>, <blade.124@laposte.net>                        *
 *                                                                         *
 *   Permission is hereby granted, free of charge, to any person obtaining *
 *   a copy of this software and associated documentation files (the       *
 *   "Software"), to deal in the Software without restriction, including   *
 *   without limitation the rights to use, copy, modify, merge, publish,   *
 *   distribute, sublicense, and/or sell copies of the Software, and to    *
 *   permit persons to whom the Software is furnished to do so, subject to *
 *   the following conditions:                                             *
 *                                                                         *
 *   The above copyright notice and this permission notice shall be        *
 *   included in all copies or substantial portions of the Software.       *
 *                                                                         *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
 ***************************************************************************/

#ifndef MAIN_H
#define MAIN_H

#include <cctype>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include "svnrev.h"

using namespace std;

enum Token_value {
  KEY, NAME, NUMBER, END, PLUS='+',
  MINUS='-', MUL='*', DIV='/',
  PRINT=';', ASSIGN='=', LP='(', RP=')', EXP='^'
};

Token_value curr_tok = PRINT;

map<string,double>table; // Pour les variables

double number_value;
string string_value;
int no_of_errors=0;

void DefaultUi(void);
double error(const string& s);
double ExecFunctions(string to_execute);
double expr(bool get);
double extract_number();
bool IsConst(string str);
bool IsKeyword(string str);
void motd();
double prim(bool get);
double ReadTable(string table_to_read);
void SetDisplayMode(unsigned short mode);
double term(bool get);
Token_value get_token();

#endif
